import brandApi from 'api/brand'
// state
let state = {
  brand_list: {
  },
  brand_type: {
    list: []
  }
}

// getters
const getters = {
  brand_list: state => state.brand_list
}
// actions
const actions = {
  brand_list ({ commit, state }, params) { // 品牌列表
    brandApi.brand_list(params).then((json) => {
      commit('BRAND_LIST', {
        params: params,
        data: json.data
      })
    })
  },
  brand_type ({ commit, state }, params) {
    brandApi.brand_type(params).then((json) => {
      commit('BRAND_TYPE', {
        params: params,
        data: json.data
      })
    })
  }
}
// mutations
const mutations = {
  BRAND_LIST (state, { data, params }) {
    state.brand_list = data
  },
  BRAND_TYPE (state, { data, params }) {
    state.brand_list = data
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
